package com.qiu.login.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.qiu.common.povo.TsUser;
import com.qiu.common.povo.User;
import com.qiu.mybatis.inter.IUserOperation;

@Controller
@RequestMapping("/mvc")
public class LoginController {
	@Autowired
	IUserOperation userOper;
	
	@RequestMapping("/hello")
	public String hello() {
		return "hello";
	}
	
	/**
	 * 登陆处理器(RESTful风格)
	 * @param user
	 * @return
	 */
	@RequestMapping(method=RequestMethod.POST)  
	public String login(User user ,ModelMap model) {
		TsUser tuser = userOper.queryByUsername("tim");
		model.addAttribute("user",tuser);
		return "main";
	}
}
